<template>
  <div class="table-slot-wrapper">
    <span class="common-text ico16 view_log_16 noClick" @click="showDetailLogDialog"></span>
  </div>
</template>

<script>
  import * as Fiber from 'fiber';
  export default {
    name: 'ProcessIdTableRender',
    props: {
      slotData: {
        type: Object,
        default: () => {}
      },
      dataType: {
        type: String,
        default: '0'
      }
    },
    data() {
      return {
        yes: $.i18n('common.yes'),
        no: $.i18n('common.no')
      };
    },
    methods: {
      showDetailLogDialog() {
        const { dataType } = this;
        const { summaryId, processId } = this.slotData;
        let isHistoryFlag = dataType == '1' ? true : false;
        var checkResult = window.callBackendMethod(
          'secretAjaxManager',
          'checkUserSecretLevel',
          summaryId
        );
        if (checkResult && checkResult.length > 0) {
          Fiber.message.warning(checkResult);
          return;
        }
        var url =
          window._ctxPath +
          '/detaillog/detaillog.do?method=showDetailLog&summaryId=' +
          summaryId +
          '&processId=' +
          processId +
          '&showFlag=2&isHistoryFlag=' +
          isHistoryFlag;
        var dialog = $.dialog({
          url: url,
          width: 1040,
          height: 480,
          title: $.i18n('collaboration.sendGrid.findAllLog'),
          //查看明细日志
          targetWindow: window.getCtpTop(),
          buttons: [
            {
              text: $.i18n('common.button.close.label'),
              handler: function handler() {
                dialog.close();
              }
            }
          ]
        });
      }
    }
  };
</script>

<style lang="scss" scoped>
  .table-slot-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
    .common-text {
      width: 16px;
      height: 16px;
      display: inline-block;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      word-break: break-word;
    }
  }
</style>
